package com.ambow.store.controller;

import com.ambow.store.controller.util.Result;
import com.ambow.store.entity.Order;
import com.ambow.store.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("orders")
public class OrderController extends BaseController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/create")
    public Result create(Integer aid, Integer[] cids, HttpSession session){
        Order order = orderService.create(aid, cids, getUidFromSession(session), getUserNameFromSession(session));
        return new Result(OK,order);
    }
}

















